-
Notifications
You must be signed in to change notification settings - Fork 131
Add Kubernetes export format to thv export command #2072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
12741a7
to
ea576eb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2072 +/- ##
==========================================
+ Coverage 49.25% 49.50% +0.25%
==========================================
Files 244 245 +1
Lines 30920 31087 +167
==========================================
+ Hits 15229 15391 +162
- Misses 14556 14560 +4
- Partials 1135 1136 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed reply. Found an issue that blocks applying these, the apiVersion
is slightly wrong.
But a few other things I noticed:
-
For servers with secrets, right now just nothing is put into the manifest. But it might be nice to ouput a warning to let users know they need to get one in place? Or maybe even stub out the secret definition in the manifest but output a message about creating the K8s secret before applying?
-
I used it on a remote MCP server, expecting it to fail since remote servers aren't supported in K8s. But it did generate a manifest, just with an empty image. I think for now it should just error out instead of generating something that's unusable?
Add support for exporting MCP server configurations as Kubernetes MCPServer resources with the --format flag. Users can now export their running servers to K8s manifests for deployment in Kubernetes. Changes: - Add pkg/export package with k8s.go for converting RunConfig to MCPServer CRD - Enhance thv export command with --format flag (json/k8s) - Convert all RunConfig fields to appropriate MCPServer spec fields - Handle environment variables, volumes, OIDC, authz, audit, telemetry - Sanitize names to comply with Kubernetes naming requirements - Add comprehensive unit tests for all export functionality - Add e2e tests for export command with both formats 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Juan Antonio Osorio <[email protected]>
Fix issues identified in PR review: 1. Fix APIVersion from toolhive.stacklok.com to toolhive.stacklok.dev - Update pkg/export/k8s.go to use correct API group - Update test assertions in pkg/export/k8s_test.go and test/e2e/export_test.go 2. Add validation for remote MCP servers - Remote servers are not supported in Kubernetes deployments - Return error if RemoteURL is set or Image is empty - Add unit tests for both error cases 3. Add warning for servers with secrets - Detect when secrets are present in RunConfig - Output warning to stderr explaining secrets must be created separately - Display list of secrets that need to be handled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
ea576eb
to
78e058e
Compare
@JAORMX updates are working well! Only other thing I was wondering, should the output be using the logger package? Just noting the differences in output format, like: ![]() |
@danbarr I don'think we need to use the logger package. We should, however, prettify that output 😄 |
Summary
Add support for exporting MCP server configurations as Kubernetes MCPServer resources with the
--format
flag.Use Case
This feature enables a smooth development-to-production workflow for MCP servers:
thv run
with various configurations (environment variables, volumes, OIDC, authorization policies, etc.)thv export --format k8s
This eliminates the need to manually recreate configurations when moving from local development to cluster deployment, reducing errors and accelerating the transition to production.
Changes
pkg/export
package with k8s.go for converting RunConfig to MCPServer CRDthv export
command with--format
flag (json/k8s)Test plan
Usage
🤖 Generated with Claude Code